﻿using System;
using System.Data;
using Wicresoft.Common;
namespace MonthlyDB.Entity
{
    [Serializable]
    [Table("Depts", "", "Monthly.ConnectionString")]
    public class Depts : Info
    {
        #region SQL column name consts
        public const string SQLCOL_ID = "ID";
        public const string SQLCOL_DEPTNAME = "DeptName";
        public const string SQLCOL_CREATETIME = "CreateTime";
        #endregion


        #region Contructors
        /// <summary>
        /// Construct empty entity
        /// </summary>
        public Depts() { }

        /// <summary>
        /// Construct entity by primary key, other fields will be assigned by 
        /// "Load" method.
        /// </summary>
        public Depts(Guid ID)
        {
            this.ID = ID;
        }
        #endregion

        public override void Init(DataRow row)
        {
            ID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_ID]);
            DeptName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_DEPTNAME]);
            CreateTime = (DateTime)ObjectType.StringTypeHelper.Read(row[SQLCOL_CREATETIME]);
        }

        #region Properties
        #region Property <Guid> ID
        [Property("ID", 16, SqlDbType.UniqueIdentifier, false, true)]
        public Guid ID
        {
            get { return _ID; }
            set { _ID = value; }
        }
        private Guid _ID = Guid.Empty;
        #endregion

        #region Property <string> DeptName
        [Property("DeptName", 50, SqlDbType.NVarChar, false, false)]
        public string DeptName
        {
            get { return _DeptName; }
            set { _DeptName = value; }
        }
        private string _DeptName = null;
        #endregion

        #region Property <string> CreateTime
        [Property("CreateTime", 8, SqlDbType.DateTime, false, false)]
        public DateTime CreateTime
        {
            get { return _CreateTime; }
            set { _CreateTime = value; }
        }
        private DateTime _CreateTime = DateTime.MinValue;
        #endregion
        #endregion




    }
}
